<template>
	<view class="container">
		<u-toast ref="uToast" />
		<view class="profile">
			<image src="../../static/tupian135.png" mode="widthfix" id="bgckground"></image>
			<image src="../../static/tupian136.png" mode="widthFix" id="address"></image>
			<text class="school">{{teacherList.school}}</text>
			<image :src="teacherList.avatar_img" mode="widthFix" style="border-radius: 50%;" id="icon"></image>
			<text class="name">{{teacherList.full_name}}</text>
			<text class="subject">数学</text>
			<view class="layout">
				<view class="label">
					{{class_name}}
				</view>
			</view>
			<view class="person">
				<view class="personal_data" @click="$toLink('../person_info/person_info',{})">
					<image src="../../static/tupian27.png" mode="widthFix"></image>
					<text>个人资料</text>
					<image src="../../static/tupian93.png" mode="widthFix"></image>
				</view>
				<!-- 	<view class="teacher_binding" @click="$toLink('../teacher_binding/teacher_binding',{})">
					<image src="../../static/tupian33.png" mode="widthFix"></image>
					<text>教师绑定</text>
					<image src="../../static/tupian93.png" mode="widthFix"></image>
				</view> -->
				<view class="my_feed" @click="$toLink('../my_tidings/my_tidings',{})">
					<image src="../../static/tupian61.png" mode="widthFix"></image>
					<text>我的动态</text>
					<image src="../../static/tupian93.png" mode="widthFix"></image>
				</view>
				<view class="collect" @click="$toLink('../enshrine/enshrine',{})">
					<image src="../../static/tupian51.png" mode="widthFix"></image>
					<text>收藏</text>
					<image src="../../static/tupian93.png" mode="widthFix"></image>
				</view>
				<view class="set" @click="$toLink('../setting/setting',{})">
					<image src="../../static/tupian47.png" mode="widthFix"></image>
					<text>设置</text>
					<image src="../../static/tupian93.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
		<u-mask :show="show">
			<view class="wrap">
				<view class="rect" @tap.stop>
					<view id="icon">
						<view class="notice" @click="$toLink('../release_notice/release_notice',{})">
							<image src="../../static/tupian16.png" mode="widthFix"></image>
							<text>发布通知</text>
						</view>
						<view id="dynamic">
							<image src="../../static/tupian16.png" mode="widthFix"></image>
							<text>发布动态</text>
						</view>
						<view id="email"  @click="$toLink('../compose_email/compose_email',{})">
							<image src="../../static/tupian17.png" mode="widthFix"></image>
							<text>发布邮件</text>
						</view>
						<view id="course" @click="$toLink('../add_course/add_course',{})">
							<image src="../../static/tupian23.png" mode="widthFix"></image>
							<text>发送课件</text>
						</view>
						<view id="upload"  @click="$toLink('../upload_photos/upload_photos',{})">
							<image src="../../static/tupian45.png" mode="widthFix"></image>
							<text>上传图片</text>
						</view>
						<image src="../../static/tupian146.png" mode="widthFix" id="del" @click.stop="hide"></image>
						<view class="hump">
						</view>
					</view>
				</view>
			</view>
		</u-mask>
		<u-tabbar :list="list" active-color="#2491FE" :mid-button="true" @change="changeIndex"></u-tabbar>

	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	import request from '../../request.js'
	export default {
		data() {
			return {
				teacher_list: {},
				show: false,
				class_name: '',
			}
		},
		computed: {
			...mapState(['list']),

			teacherList() {
				if (this.teacher_list) {
					return this.teacher_list;
				} else {
					return {}
				}
			}

		},
		onShow() {
				this.getMyInfo();
		},
		methods: {
			getMyInfo() {
				let base_url = uni.getStorageSync('host');
				console.log(base_url);
				let _this = this;
				request({
					url: base_url + 'teacher/user/getMyInfo',
					method: 'post',
					success(res) {
						if (res.statusCode == 200) {
							let arr = [];
							let filter_arr = [];
							console.log(res.data.data);
							_this.teacher_list = res.data.data;
							arr = res.data.data.classes;
							filter_arr = arr.map(item => {
								return item.classes_name;
							})
							console.log(filter_arr);
							_this.class_name = filter_arr.join(',');
							console.log(_this.class_name);


						} else {
							_this.$refs.uToast.show({
								title: res.data.message || '系统错误',
								type: 'warning',
							})
						}

					}
				})
			},
			changeIndex(e) {
				console.log(e);
				switch (e) {
					case 2:
						this.show = !this.show;

				}
			},
			hide() {
				this.show = !this.show;
			},
		}

	}
</script>

<style lang="scss">
	.container {
		width: 100%;
		background: #F2F2F2;
		height: 100vh;

		.profile {
			width: 100%;
			height: 940rpx;
			position: relative;

			#bgckground {
				width: 750rpx;
				position: absolute;
				top: 0;
				left: 0;
			}

			#address {
				width: 22rpx;
				z-index: 10;
				left: 20rpx;
				top: 37rpx;
				position: absolute;
			}

			.school {
				width: 400rpx;
				z-index: 10;
				font-size: 30rpx;
				color: #fff;
				left: 60rpx;
				top: 28rpx;
				position: absolute;
			}

			#icon {
				width: 113rpx;
				position: absolute;
				top: 73rpx;
				z-index: 10;
				left: 318rpx;

			}

			.name {
				font-size: 36rpx;
				color: #fff;
				height: 36rpx;
				width: 150rpx;
				text-align: center;
				position: absolute;
				z-index: 10;
				top: 204rpx;
				left: 300rpx;
			}

			.subject {
				font-size: 30rpx;
				color: #fff;
				height: 30rpx;
				width: 100rpx;
				text-align: center;
				position: absolute;
				z-index: 10;
				top: 269rpx;
				left: 325rpx;
			}

			.layout {
				width: 100%;
				left: 0rpx;
				height: 40rpx;
				position: absolute;
				z-index: 10;
				top: 350rpx;
				display: flex;
				justify-content: center;

				.label {
					font-size: 26rpx;
					color: #fff;
					height: 40rpx;
					border-radius: 4rpx;
					line-height: 40rpx;
					background: #2f96fe;
				}

			}



			.person {
				width: 710rpx;
				height: 790rpx;
				position: absolute;
				background: #fff;
				border-radius: 20rpx;
				z-index: 10rpx;
				left: 20rpx;
				top: 420rpx;

				.personal_data {
					width: 94%;
					height: 94rpx;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					border-bottom: 1px solid #F2F2F2;
					margin-left: 3%;

					image {
						&:nth-child(1) {
							width: 45rpx;
						}

						&:nth-child(3) {
							width: 20rpx;
						}
					}

					text {
						&:nth-child(2) {
							font-size: 30rpx;
							color: #333333;
							width: 550rpx;
							margin-left: 40rpx;
						}
					}
				}

				.teacher_binding {
					width: 94%;
					height: 94rpx;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					border-bottom: 1px solid #F2F2F2;
					margin-left: 3%;

					image {
						&:nth-child(1) {
							width: 35rpx;
						}

						&:nth-child(3) {
							width: 20rpx;
						}
					}

					text {
						&:nth-child(2) {
							font-size: 30rpx;
							color: #333333;
							width: 550rpx;
							margin-left: 50rpx;
						}
					}
				}

				.my_feed {
					width: 94%;
					height: 94rpx;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					border-bottom: 1px solid #F2F2F2;
					margin-left: 3%;

					image {
						&:nth-child(1) {
							width: 35rpx;
						}

						&:nth-child(3) {
							width: 20rpx;
						}
					}

					text {
						&:nth-child(2) {
							font-size: 30rpx;
							color: #333333;
							width: 550rpx;
							margin-left: 50rpx;
						}
					}
				}

				.collect {
					width: 94%;
					height: 94rpx;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					border-bottom: 1px solid #F2F2F2;
					margin-left: 3%;

					image {
						&:nth-child(1) {
							width: 35rpx;
						}

						&:nth-child(3) {
							width: 20rpx;
						}
					}

					text {
						&:nth-child(2) {
							font-size: 30rpx;
							color: #333333;
							width: 550rpx;
							margin-left: 50rpx;
						}
					}
				}

				.set {
					width: 94%;
					height: 94rpx;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					border-bottom: 1px solid #F2F2F2;
					margin-left: 3%;

					image {
						&:nth-child(1) {
							width: 35rpx;
						}

						&:nth-child(3) {
							width: 20rpx;
						}
					}

					text {
						&:nth-child(2) {
							font-size: 30rpx;
							color: #333333;
							width: 550rpx;
							margin-left: 50rpx;
						}
					}
				}
			}
		}

		.wrap {
			width: 100%;
			display: flex;
			align-items: flex-end;
			justify-content: center;
			height: 100%;

			.rect {
				margin-bottom: 150rpx;
				width: 710rpx;
				height: 377rpx;
				border-radius: 20rpx;

				#icon {
					height: 357rpx;
					background: #fff;
					width: 100%;
					border-radius: 20rpx;
					position: relative;

					.hump {
						width: 220rpx;
						height: 120rpx;
						position: absolute;
						left: 245rpx;
						top: 248rpx;
						background: #fff;
						border-radius: 50%;
					}

					.notice {
						width: 130rpx;
						height: 105rpx;
						left: 77rpx;
						top: 40rpx;
						position: absolute;
						z-index: 100;
						display: flex;
						justify-content: flex-start;
						flex-direction: column;
						align-items: center;

						image {
							&:nth-child(1) {
								width: 47rpx;
							}
						}

						text {
							&:nth-child(2) {
								margin-top: 20rpx;
								color: #333333;
								font-size: 30rpx;
							}
						}
					}

					#dynamic {
						width: 130rpx;
						height: 105rpx;
						left: 291rpx;
						top: 40rpx;
						position: absolute;
						z-index: 100;
						display: flex;
						justify-content: flex-start;
						flex-direction: column;
						align-items: center;

						image {
							&:nth-child(1) {
								width: 47rpx;
							}
						}

						text {
							&:nth-child(2) {
								margin-top: 20rpx;
								color: #333333;
								font-size: 30rpx;
							}
						}
					}

					#email {
						width: 130rpx;
						height: 105rpx;
						left: 505rpx;
						top: 40rpx;
						position: absolute;
						z-index: 100;
						display: flex;
						justify-content: flex-start;
						flex-direction: column;
						align-items: center;

						image {
							&:nth-child(1) {
								width: 45rpx;
								margin-top: 5rpx;
							}
						}

						text {
							&:nth-child(2) {
								margin-top: 25rpx;
								color: #333333;
								font-size: 30rpx;
							}
						}
					}

					#course {
						width: 130rpx;
						height: 105rpx;
						left: 140rpx;
						top: 180rpx;
						position: absolute;
						z-index: 100;
						display: flex;
						justify-content: flex-start;
						flex-direction: column;
						align-items: center;

						image {
							&:nth-child(1) {
								width: 47rpx;
							}
						}

						text {
							&:nth-child(2) {
								margin-top: 20rpx;
								color: #333333;
								font-size: 30rpx;
							}
						}
					}

					#upload {
						width: 130rpx;
						height: 105rpx;
						left: 440rpx;
						top: 180rpx;
						position: absolute;
						z-index: 100;
						display: flex;
						justify-content: flex-start;
						flex-direction: column;
						align-items: center;

						image {
							&:nth-child(1) {
								width: 47rpx;
							}
						}

						text {
							&:nth-child(2) {
								margin-top: 20rpx;
								color: #333333;
								font-size: 30rpx;
							}
						}
					}

					#del {
						width: 51rpx;
						position: absolute;
						z-index: 1000;
						left: 330rpx;
						top: 305rpx;
					}

				}

			}
		}
	}
</style>
